package notifiers;

import java.util.List;

import controllers.Tasks;

import play.mvc.Mailer;

import models.Task;
import models.TaskType;
import models.User;
import models.UserStory;

public class Mails extends Mailer {

	public static void test(User user) {
		setFrom("Coolsoft@blabla.com");
		setSubject("Test mail");
		addRecipient("salem.sayed@gmail.com");
		send(user);
	}

	public static void notifyTaskReview(User user, Task task, String subject,
			String comment) {
		User reviewer = task.getTaskReviewer(true);
		setFrom("Coolsoft@SMT.com");
		setSubject(subject);
		addRecipient(user.email);
		send(user, task, comment, reviewer);
	}

	/**
	 * @param user
	 *            This method sends a mail to every user on registration
	 */
	public static void welcome(User user) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Registration");
		addRecipient(user.email);
		send(user);
	}

	public static void notifyEditTask(User creator, User editor, Task task,
			String temp) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Notification");
		addRecipient(creator.email);
		send(creator, editor, task, temp);
	}

	public static void notifyUserStoryStatus(User creator, String message,
			UserStory userStory) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Notification");
		addRecipient(creator.email);
		send(creator, message, userStory);
	}

	public static void notifyTaskTypeReviewRequest(User approver, String message) {
		setFrom("coolsoft@gmail.com");
		setSubject("Review Request");
		addRecipient(approver.email);
		send(approver, message);
	}

	// public static void notifyEditTask(t.creator,editor,temp)

	/**
	 * sends notification when change the the task status
	 * 
	 * @param userTo
	 * @param editor
	 * @param task
	 */
	public static void notifyChangeTaskStatus(User userTo, User editor,
			Task task) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Notification");
		addRecipient(userTo.email);
		send(userTo, editor, task);
	}

	public static void notifyTaskTypeReviewResponse(User reviewer,
			String message, String subject) {
		setFrom("coolsoft@gmail.com");
		setSubject(subject);
		addRecipient(reviewer.email);
		send(reviewer, message);
	}

	public static void editPB(User edit, String message, String subject) {
		setFrom("coolsoft@gmail.com");
		setSubject(subject);
		addRecipient(edit.email);
		send(edit, message);
	}

	public static void notify(User user, String subject, String message,
			String link) {
		setFrom("coolsoft@gmail.com");
		setSubject(subject);
		addRecipient(user.email);
		send(user, message, link);
	}

	/**
	 * this methods sends notification for editing story
	 * 
	 * @param userTo
	 * @param editor
	 * @param message
	 * @param storyId
	 */
	public static void notifyStoryEdit(User userTo, User editor,
			String message, Long storyId) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Notification");
		addRecipient(userTo.email);
		send(userTo, editor, message, storyId);
	}

	public static void notifyDeleteTask(User user, User editor, Task task) {
		setFrom("Coolsoft@SMT.com");
		setSubject("Notification");
		addRecipient(user.email);
		send(user, editor, task);
	}
}